#!/usr/bin/env python
# coding: utf-8

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
import hug


deepThought = ChatBot("deepThought", read_only=True)
# deepThought = ChatBot("deepThought")
# 开启自动学习
deepThought.set_trainer(ChatterBotCorpusTrainer)
# 使用中文语料库训练它
deepThought.train("chatterbot.corpus.chinese")
# 语料库


@hug.get()
def get_response(user_input):
    response = deepThought.get_response(user_input).text
    return {"response":response}
